import React, { Component } from 'react';
import {connect} from "react-redux";

class Main extends Component {
	constructor(props) {
		super(props);
		this.state = {
		}
	
	}
	render() {
		return (
			<div>首页</div>
		);
	};
	async componentWillMount() {
	}
	async componentDidMount() {
	};
	componentWillUnmount() {
	};
}

//props of state
const mapStateToProps = (state, action) => {
	return {
		innerWidth: state.page.innerWidth,
		innerHeight: state.page.innerHeight,
	}
};
//props of dispatch
const mapDispatchToProps = (dispatch, ownProps) => {

	return {
		changeInner: (props) => {
			dispatch({ type: 'CHANGE_INNER', ...props});
		},
		changeCarList: (props) => {
			const params = {carList: props.carList, rollerInFlag: props.rollerInFlag};
			dispatch({ type: 'CHANGE_CARLIST', ...params});
		}
	}
};

/*
* connect方法
* 将需要的状态与相应的组件绑定起来
* connect(mapStateToProps, mapDispatchToProps)
* */
Main = connect(mapStateToProps, mapDispatchToProps)(Main);
export default Main
